
package DBLayer;
import ModelLayer.Person;
import java.util.ArrayList;

/**
 * @version 12/22/2011
 * @author Gruppe 4
 */

public interface IFDBPerson {
    //get all customers
    public ArrayList<Person> getAllCustomers();
    
    //get all employees
    public ArrayList<Person> getAllEmployees();
    
    /**
     * 
     * @param id The id of the person to be found
     * @param retrieveAssociation Whether or not to build associations
     * @param isEmployee True: The person is an employee false: a customer
     * @return ArrayList<Person> ArrayList of persons
     */
    public ArrayList<Person> findPersonsId(int id , boolean retrieveAssociation, boolean isEmployee);
    
    /**
     * The method finds all persons (employee or customer) matching a
     * specified first name
     * @param fName First name of the person to be found
     * @param retrieveAssociation Whether or not to build associations
     * @param isEmployee True: The person is an employee false: a customer
     * @return ArrayList<Person> ArrayList of persons
     */
    public ArrayList<Person> findPersonsfName(String fName, boolean retrieveAssociation, boolean isEmployee);
    
    /**
     * The method finds all persons (employee or customer) matching a
     * specified last name
     * @param lName Last name of the person to be found
     * @param retrieveAssociation Whether or not to build associations
     * @param isEmployee True: The person is an employee false: a customer
     * @return ArrayList<Person> ArrayList of persons
     */
    public ArrayList<Person> findPersonslName(String lName, boolean retrieveAssociation, boolean isEmployee);
    
    /**
     * The method returns a person matching the specified id
     * @param personId The id of the person to be found
     * @param retrieveAssociation Whether or not to build associations
     * @param isEmployee The person is an employee false: a customer
     * @return Person The person found
     */
    public Person findPerson(int personId, boolean retrieveAssociation, boolean isEmployee);
    
    /**
     * The method inserts a person (employee or customer)
     * @param person The person to be inserted
     * @return int an int 1 if the method succedes and -1 if the method fails
     * @throws Exception 
     */
    public int insertPerson(Person person) throws Exception;
    
    /**
     * The method updates information regarding a person (employee or customer)
     * @param person The person which information is to be updated
     * @return int an int 1 if the method succedes and -1 if the method fails
     */
    public int updatePerson(Person person);
    
    /**
     * Method that deletes a person from the database
     * @param personId Person id of the person to be found
     * @param isEmployee True: The person is an employee false: a customer
     * @return returns an int 1 if the method succedes and -1 if the method fails
     */
    public int deletePerson(int personId, boolean isEmployee);
    
}
